<template>
    <view>
        <phone-directory :phones="phones" @paramClick="paramClick" @input="inputChange"></phone-directory>
    </view>
</template>

<script>
	import phoneDirectory from '@/components/phone-directory/phone-directory.vue'
	import { postBrandList } from "../../api/home.js"
		
		export default {
		    name:"phones",
		    components:{
		        phoneDirectory
		    },
		    data() {
		        return {
		            phones:{}
		
		        }
		    },
			onLoad() {
				this.init()
			},
		    methods : {
				init(){
					this.getbrand()
				},
		        paramClick (e) {
		            uni.$emit('brand', e)
					uni.navigateBack()
		        },
				
				inputChange(e) {
					this.getbrand(e.detail.value)
				},
				
				async getbrand(search) {
					var data = new Object();
					data.search = search || ''
					var value = await postBrandList(data);
					if(value.data.code == 1) {
						console.log(value.data.data)
						this.phones = value.data.data;
					}
				}
		    }
		}
	
</script>
<style>

</style>